package com.oa.hyperion.utils;

import java.text.SimpleDateFormat;
import java.util.Date;

public class DBUtils {
    public static boolean isEmpty(String s) {
        return s==null || s.trim().length() == 0;
    }

    public static boolean isNotEmpty(String s) {
        return !isEmpty(s);
    }

    public static boolean isEmpty(Date date) {
        String time = dateToString(date);
        return time==null || time.trim().length() == 0;
    }

    public static boolean isNotEmpty(Date date) {
        return !isEmpty(date);
    }

    /**
     * 将日期格式转换为字符串
     * author yuanchongwei
     * date 2022-1-18
     * @param date
     * @return
     */
    public static String dateToString(Date date){
        //将date转换为string
        String pattern = "yyyy-MM-dd hh:MM:ss";
        SimpleDateFormat sdf = new SimpleDateFormat(pattern);
        return sdf.format(date);
    }

}
